//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    members: []
  },
  onShow() {
    app.$http('/members').then(response => {
      this.setData({
        members: response
      })
    }, error => {})
  },
  openMemberMsg(e) {
    wx.navigateTo({
      url: '../member/add'
    })
  },
  setMemberData(e) {
    wx.setStorage({
      key: 'indexMemberData',
      data: JSON.stringify(this.data.members[e.currentTarget.dataset.index])
    })
    wx.navigateTo({
      url: '../member/msg'
    })
  }
})
